Add a button to set the job positions to the vehicle position - #1314
helgehelge123 wants to merge 2 commits into
Conversation
getNumberOfItemsInSection() built contextActionMapping by iterating the CONTEXT_ACTIONS table with pairs(). That table has integer keys assigned in the constructor, so pairs() returns them in Lua hash order, not in index order, and the buttons in the lower right corner could show up in any order. Use ipairs() so the buttons always appear in the order the actions are defined in. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
When creating a job while already standing on the field, the target position and the field/silo position still have to be picked on the map, which is fiddly and easy to get wrong. Add a "Target & field to vehicle" button to the job parameter list that sets both to the vehicle's current position in one click, the target position also gets the direction the vehicle is facing. It is placed in a group of its own right below the position parameters, so it is not clicked by accident, and only shows up for jobs that actually have such a position. The same action is available as a context button in the lower right corner and bound to a new, rebindable input action CP_SET_POSITIONS_TO_VEHICLE (KEY_v by default, that key is unused in the menu), so the usual work flow can be done with the keyboard alone: V set the positions, C generate the course, X start the job. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Die Übersetzung muss in die MasterTranslation.xml https://github.com/Courseplay/Courseplay_FS25/wiki/Translations |
|
@Tensuko Hättest du einen Wunsch in welche Kategorie es mit aufgenommen werden könnte, um eine Zeile zu sparen? |
|
Wir haben das nicht ohne Grund separat aufgebaut. |
|
Ich möchte nicht die Punkte zusammenführen. Mir geht es um den Fall, dass man mal eben ein Feld weiter fährt und dann von dort aus den Auftrag starten möchte. Das kommt bei mir häufig bei "Ballen Sammeln" und eigenen Feldern vor, die nah beieinander liegen. Dort ist es sehr angenehm, den Startpunkt direkt auf den Spot zu setzen, an dem man sich befindet. |

Problem
When a job is created from the course generator page, the vehicle is usually already standing on the field, in position - but the target position and the field position still have to be picked on the map. That means two mouse picks for something the vehicle already knows, and it is easy to drop the field position on a neighbouring field or a headland of the wrong field.
What this adds
A Target & field to vehicle button in the job parameter list, which sets the target position (including the direction the vehicle is facing) and the field/silo position to the vehicle's current position with one click.
Details:
invalidmarker is hidden, it can't be invalid).validateParameters()andupdateParameterValueTexts()run, so the field boundary detection restarts for the new field position, just like after picking it manually.getCanBeChanged()) are left alone.Key binding
The same action is also available as a context button in the lower right corner, bound to a new rebindable input action
CP_SET_POSITIONS_TO_VEHICLE,KEY_vby default.KEY_vis not used by anyMENU_*action in the base game input bindings, it is only bound to vehicle and construction actions, which are not active while the menu is open.The context button is only active while a job is being created and while nothing is being picked on the map, so the usual workflow can be done from the keyboard alone: V set the positions, C generate the course, X start the job.
That order is also the reason for the first commit in this PR:
getNumberOfItemsInSection()builtcontextActionMappingby iteratingCONTEXT_ACTIONSwithpairs(). The table has integer keys, but they are assigned in the table constructor, sopairs()returns them in hash order and the context buttons could show up in any order. Usingipairs()makes the order deterministic and follows the order the actions are defined in.Translations are added for English and German, other languages fall back to English.
Testing
Tested in game with Courseplay 8.1.0.3 (screenshot above, German UI, bale collecting job): the button sets both positions to the vehicle position including its direction, the
Vkey does the same, the button list keeps the intended order, and the button is not shown outside of job creation.🤖 Generated with Claude Code